package portal.action.rest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import portal.action.entity.LoginInfo;
import portal.mybatis.dao.User;
import portal.mybatis.dao.service.UserService;

@RestController
public class LoginAction {
	UserService userService;
	@RequestMapping(value="uLogin",method=RequestMethod.POST)
	public void login(LoginInfo lInfo,HttpServletRequest req ,HttpServletResponse resp){
		if(lInfo==null)
			return;
		User user= userService.checkUser(lInfo.getUserName(), lInfo.getPassWord());
		if(user !=null){
			HttpSession session=req.getSession(true);
			session.setAttribute("loginUser", lInfo);
		}
		///if(session==null)
	}
}
